// EditorView.h : interface of the CEditorView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_EDITORVIEW_H__5E609F55_88DE_485E_8A3E_C5EC93C3731F__INCLUDED_)
#define AFX_EDITORVIEW_H__5E609F55_88DE_485E_8A3E_C5EC93C3731F__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "EditorDoc.h"

class CEditorView : public CScrollView
{
protected: // create from serialization only
	CEditorView();
	DECLARE_DYNCREATE(CEditorView)

// Attributes
public:
	CEditorDoc* GetDocument();

	typedef CTilesetKit::TILE TILE;
	typedef CEditorDoc::GRID GRID;

	void	SetLevel(int nLevel);
	int		GetLevel()const;

protected:
	CBrush m_brBkgnd;
	CPen m_pnLine;
	CPen m_pnScreen;

	BOOL m_bViewGrid;
	BOOL m_bScreen;

	CPoint m_ptScreen;

	BOOL	m_bErase;

	int		m_nLevel;

protected:
	BOOL	m_bDragging;
	CPoint	m_ptOffset;

	int HitTest(const CPoint& pt);

	void PaintAt(const CPoint& pt);
	void EraseAt(const CPoint& pt);

	CRect m_rBox;

	bool GetFocusRect(int nIndex, CRect& rect);

	void DoDraw(CDC* pDC);
// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CEditorView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual void OnInitialUpdate(); // called first time after construct
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CEditorView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CEditorView)
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
	afx_msg void OnUpdateViewGrid(CCmdUI* pCmdUI);
	afx_msg void OnViewGrid();
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnEditUndo();
	afx_msg void OnUpdateErase(CCmdUI* pCmdUI);
	afx_msg void OnErase();
	afx_msg void OnEditRedo();
	afx_msg void OnUpdateEditRedo(CCmdUI* pCmdUI);
	afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI);
	afx_msg void OnClearAll();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in EditorView.cpp
inline CEditorDoc* CEditorView::GetDocument()
   { return (CEditorDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_EDITORVIEW_H__5E609F55_88DE_485E_8A3E_C5EC93C3731F__INCLUDED_)
